package com.example.email.batch;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;



@Component
public class BatchSendEmailTest {
    @Autowired
    private JavaMailSender mailSender;

    @Test
    public void send() {
        SimpleMailMessage message = new SimpleMailMessage();
        // 发件人
        message.setFrom("1761327520@qq.com");
        // 收件人
        message.setTo("zhanghl1025@163.com");
        // 邮件标题
        message.setSubject("Java发送邮件第二弹");
        // 邮件内容
        message.setText("你好，这是一条用于测试Spring Boot邮件发送功能的邮件！哈哈哈~~~");
        // 抄送人
        // message.setCc("1761327520@qq.com");
        mailSender.send(message);
    }

}
